<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        const JSONobj = {
            "name": "张三",
            "age": 18,
        }
        console.log(JSONobj);

        // JSON对象转字符串 stringify
        const JSONstr = JSON.stringify(JSONobj);
        console.log(JSONstr);

        // 字符串转JSON对象 parse
        const JSONobj2 = JSON.parse(JSONstr)
        console.log(JSONobj2);
    </script>
</body>

</html>